package com.liuqi09.mapper;

import com.liuqi09.po.Playlist;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author LiuQi
 * @create 2025-10-20-17:01
 */
public interface PlaylistMapper {

    @Insert("insert into playlists(id,name,user_id) values(#{id},#{name},#{user_id})")
    public int addPlaylist(Playlist playlist);

    @Delete("delete from playlists where id= #{id}")
    public int deletePlaylist(Integer id);

    @Update("update playlists set name=#{name},user_id = #{user_id}  where id=#{id}")
    public int updatePlaylist(Playlist playlist);

    @Select("select * from playlists where id= #{id}")
    public Playlist queryPlaylistById(Integer id);

    @Select("select * from playlists where user_id= #{user_id}")
    public List<Playlist> queryPlaylistByUserId(Integer user_id);
}
